home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13596 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Coding Standards
  5. Date: 26 Mar 1996 16:23:59 GMT
  6. Organization: Borland International
  7. Message-ID: <4j95mv$74n@druid.borland.com>
  8. References: <4j2kgg$svj@sam.inforamp.net> <4j3vc6$nrk@news1.h1.usa.pipeline.com>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <4j3vc6$nrk@news1.h1.usa.pipeline.com>, grantp@usa.pipeline.co 
  15. says...
  16. >
  17. >On Mar 24, 1996 04:53:18 in article <Re: Coding Standards>,
  18. >'rmorin@inforamp.net (Randy Charles Morin)' wrote: 
  19. >>In article <4iuu6k$6a6@druid.borland.com>, 
  20. >>pete@borland.com (Pete Becker) wrote: 
  21. >>>Unfortunately, if you don't follow guidelines like this, you will miss
  22. >your  
  23. >>>subsequent maintenance deadlines by many years. You'll spend all your
  24. >time  
  25. >>>tracking down mysterious failures that arise when you try to enhance the 
  26. >
  27. >>>program, rather than spending time on the enhancements themselves. 
  28. >> 
  29. >>But if you follow these guidelines, your initial release will miss your  
  30. >>subsequent maintenance deadlines.  You have to be reasonable in these  
  31. >>situations.   
  32. >Right.  I will nearly always vote on the side of reasonableness. Seems  
  33. >to me that since writing a trivial copy constructor can be implemented 
  34. >in a matter of seconds, it's just a good habit to write one even if its 
  35. >need isn't obvious at the time the class is in its initial stages of 
  36. >development.  I doubt seriously if a few seconds, or even a minute or 
  37. >two, spent at writing a copy constructor for all classes will cause 
  38. >significant delays in product delivery. 
  39.  
  40. Actually, it was not my intention to endorse automatically writing trivial copy 
  41. constructors. I do trust maintenance programmers to recognize that code they've 
  42. added requires a copy constructor, and to either change the existing one or 
  43. write a new one as necessary. What I had in mind was rules like always having a 
  44. virtual destructor whenever you have any other virtual functions. Violate this 
  45. one at your peril: you may not intend to pass pointers to this function 
  46. initially, but two days before you're due to ship your product you'll find a 
  47. bug that requires deleting a pointer to your class, and it will not work right 
  48. if you don't have a virtual destructor.
  49.  
  50. >>        Why not make the standard that if you add a data member that may  
  51. >>cause the default copy constructor to produce erroneous results, then 
  52. >>make one explicitly?  This way you only have to write them when you need 
  53. >>to and you have the same end result. 
  54. >> 
  55. >If we can rely on the maintenance programmer to think about the 
  56. >problem, then OK, but that's not the real world.  IMHO, Pete Becker is 
  57. >absolutely correct in this matter -- well, maybe he exaggerated just 
  58. >a little bit... 
  59.  
  60. You caught me: I do sometimes exaggerate just a little bit...
  61.  
  62.